package com.ruoyi.web.controller.qsng;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.qsng.domain.KClearinghouseFocus;
import com.ruoyi.qsng.service.IKClearinghouseFocusService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 交流中心_关注Controller
 * 
 * @author kanglou
 * @date 2023-06-07
 */
@RestController
@RequestMapping("/qsng/focus")
@Api(tags = "pc--交流中心_关注Controller")
public class KClearinghouseFocusController extends BaseController
{
    @Autowired
    private IKClearinghouseFocusService kClearinghouseFocusService;

    /**
     * 查询交流中心_关注列表
     */
    @PreAuthorize("@ss.hasPermi('qsng:focus:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查询交流中心_关注列表")
    public TableDataInfo list(KClearinghouseFocus kClearinghouseFocus)
    {
        startPage();
        List<KClearinghouseFocus> list = kClearinghouseFocusService.selectKClearinghouseFocusList(kClearinghouseFocus);
        return getDataTable(list);
    }

    /**
     * 导出交流中心_关注列表
     */
    @PreAuthorize("@ss.hasPermi('qsng:focus:export')")
    @Log(title = "交流中心_关注", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value = "导出交流中心_关注列表")
    public void export(HttpServletResponse response, KClearinghouseFocus kClearinghouseFocus)
    {
        List<KClearinghouseFocus> list = kClearinghouseFocusService.selectKClearinghouseFocusList(kClearinghouseFocus);
        ExcelUtil<KClearinghouseFocus> util = new ExcelUtil<KClearinghouseFocus>(KClearinghouseFocus.class);
        util.exportExcel(response, list, "交流中心_关注数据");
    }

    /**
     * 获取交流中心_关注详细信息
     */
    @PreAuthorize("@ss.hasPermi('qsng:focus:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value = "获取交流中心_关注详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(kClearinghouseFocusService.selectKClearinghouseFocusById(id));
    }

    /**
     * 新增交流中心_关注
     */
    @PreAuthorize("@ss.hasPermi('qsng:focus:add')")
    @Log(title = "交流中心_关注", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value = "新增交流中心_关注")
    public AjaxResult add(@RequestBody KClearinghouseFocus kClearinghouseFocus)
    {
        return toAjax(kClearinghouseFocusService.insertKClearinghouseFocus(kClearinghouseFocus));
    }

    /**
     * 修改交流中心_关注
     */
    @PreAuthorize("@ss.hasPermi('qsng:focus:edit')")
    @Log(title = "交流中心_关注", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation(value = "修改交流中心_关注")
    public AjaxResult edit(@RequestBody KClearinghouseFocus kClearinghouseFocus)
    {
        return toAjax(kClearinghouseFocusService.updateKClearinghouseFocus(kClearinghouseFocus));
    }

    /**
     * 删除交流中心_关注
     */
    @PreAuthorize("@ss.hasPermi('qsng:focus:remove')")
    @Log(title = "交流中心_关注", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation(value = "交流中心_关注")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(kClearinghouseFocusService.deleteKClearinghouseFocusByIds(ids));
    }
}
